refactor and rework