Documentation, and replaced a hack-hotfix with a better design