misc refactor