Minor changes
Fixed pattern matching
Added pattern match tests