Refactor mustache sanity check