Imported from SVN by Bitbucket
Different small refactorings.
Made everything build again.