@done: optimize with memoization
Merge branch 'improve-jajascript-performance'