Tidied up the structure a bit