refactored to list the cases out