move the Database class one layer up; remove the factory from the lib and work on unit tests