WORKING: removed redundant classes, and tidied up implementation