Added integration tests, corrected controllers and models because tests revealed some bugs