bug fixes and router refactoring
resolved conflicts