removed redundancies, now works correctly, added 'clean' method