First working version of the raycaster