Refactor assays and onCurrentElementChange