refactored routes, made tests more robust