Completely fixed all current problems with raycasting.