MySQL class refactored