rearranging

move shared stuff into core and out of parsing.
fix way expression works