Tidy up some mysql stuff