minor code refactor