major cleanup of formatting and minor errors