Changed MySQL query to use OOP wrapper