added memoization
pseudo-classical inheritance for javascript