refactored databaseconnector into separate methods