Clean GrandMaster code (remove gm prefixes), add unit tests for GrandMaster