variable renames and function reordering
merge
code cleanup