New Local DB code

Removed old code and replaced with new