Lot's of comments and small refactoring.