adding database factory