de-uglify pattern matching implementation some more