implement complex deps handling in cleandeps/unneeded calculation