Performance, consistency changes

Inline variables, redundant code removed, performance enhancements,
general cleanup