Can anyone see what is wrong in this code? I tried different implementations without any success so i guess there's something wrong i just can't see or understand. Please help!