Fixing routes and adding REST endpoint