move some parser code around towards mixin pattern