Adding in MySQL logic