+1 for Laila's comment. Memoization is also making it less readable