refactor and clarify