Code commented + Final bugfixes and cleanups