Improving rebase formula. WIP