refactor and adding routes