Updated routing functions, to specify common function from routes file. Helps to set variables before routing