avoid calls on repeated accesses and allow implementation of other variants Fixed indentation in diff implementation