MySQLClient: refactoring and optimization