refactored into mysql manager and profit