Tons of minor bugfixes, after which sugar/pattern-patterns seems to be working