Before modifying to integrate pattern match