This reverts commit 66cea846. I did not intend to commit all the changes in here, but only the ones with no significant differences.