fixed controller into seperate files and added unit tests