refactor tests and routes