Minor re-factoring and code formatting.