adding clean way for closure to preserve the element scope