some small edits
renamed code chunks