added -a method
replaced ray.sign int with mask
moved convert/cast methods to top, added casting logic methods
removed now unnecessary casts now