Changed ray caluclation