First working version of the history. Many refactorings within this process. Many bug fixes, too.