add test for removing optional item and refactoring after test