Feature #46, added some tests and refactored routes and utils