router done
refactored router code