major refactor to have controllers
utility methods, bug fixes