refactor and design