Added functions for primary rays