progress
pattern matching is mostly complete
adding back features; some already fix flaws of the previous implementation :)