Clean/refactor some hidpi code