added localdb cleanup and unit tests