Improved handling, added 'delete' and unit tests