Refactoring, also, bind scope properties to local variables
Added documentation for local vars