Tidied up code and feature (removed redundancies)