added reachability checking
merged