reconfigured main() as startup() and main().
added key database access