begun rewriting, added class Ray