rebase and refactor