optimization: early return on dereferenced
simplest (but working memoization)