Committing a bunch of code including more progress on the new overlap fixing and some refactoring.