added directed functionality