refactored ray creation