added tests and routing code