refactor and problems with routes