fixing inefficient use of hashmap to store rays
jindent
Using a (eh)cache to avoid redundant method lookups in the class object