Modified unit tests and fixed errors in controller