refactored utility methods out of controller and into their own utitity class. this should make it easier to reuse and test that code.