Add master anchors

also cleans up some trailing whitespace and fixes compile errors on the agent test.