tons of activerecord optimizations -- tons of cleanup / refactoring and general code smell fixes / tweaks