added router implementation and tests