clean up and minor revisions for sec and readability.