Tidied up design and code etc