Tidied up a few things now I've got the MySQL stuff working