Minor code cleaning and refactoring.