Add Rake plus some minor refactorings.