used case instead of if/else