Perfomance enhancements

No parallelization or memoization yet...