Added better conflict detection and fixed rebase detection