Implemented some perf improvements

@jdimond - Please review and merge.