updated how controllers are written
some refactoring