minor code refacotring.