pattern match
refactory