more work on parsing and template stuff