Some minor code refactor.