parser: got rid of some type assertions
parser: New intermediate types for better type safety