Changes to checkDeleted and added recycle function