handleroute method exported to library and added tests #1