Add option for node of source target

Please, use a single `if` statement instead of `fromNode ?` specified 3 times.