this code sucks - time to use memoization
adding element class