[Magic-HD] Some code clean up.