Tidied up a little after adding checks