[Magic-HD] Some code cleanup.