Some minor refacotring.