Additional parsing refactoring

This is mostly additional refactoring based on the comments in #359.