REF speed up by removing redundant code