Move most of the parsing logic into categories.
Remove occurrences of [].