used case instead of just patterns.