minor improvements, cited Stack Overflow post for deleting an item