finally renamed methods from FlowManager to database. almost ready for deployment