minor code structure refactor