implemented ray class