Refactor of db, added setup options
Fixed mistake in setup.py