added ray class
fixed some bugs (heh, heh), added Ray type