dimred function added