mhgraphics code refactor attempt