Bug fixes, added master key, and some db name functionalty