refactored, added db_running field