some pattern matching working