More tests, stub of restoring localdb from amazon, cleaned code