Make sure we don't go over the maximum number of locals.
Clean up parsing a bit.