Refactor rotating ray