refactor for code clarity