Lots of things

* Replace tabs with spaces
* Replace all errors with flashes
* Made operations that get a count more efficient