code cleanup, global vars removed, arc objects moved to elements
resolved conflicts after merge