Added function comment and cleaned up the formating.