Set routes variable to object, changed some parameter checking and set v...

...ariables that needed to be set