Small refactorings done and typos fixed.