Added a route for sync and added tests for sync. Fixes #7, fixes #2