Commit before bed

Added handful of fixes/optimizations. Need to commit more often.