added intermediate refactor