refactor and add ability to capture arguments from routes