Fixed deletion of files. Added tests for deletion