recoded from raycaster project and with my own thigamajigy