Minor Optimizations.

Changed some things around, slightly speeding up the code.