Tidied up SQL formatting