Fixing style, optimizations.

Fixing style to use 4 space tabbing (Was using 2 space originally). Optimizations to startup and a couple internal interfaces (fixing logic flow and optimizing declarations use of CPU and memory Similar to #1).