Incorporate suggestions from Dilip Dutta and clean up.