Cleaned up messy indentation
Clean up
Various performance hacks
Fixed test