editing some routes and adding some logic