refactor based on PR feedback