minor edits, mainly code prettification