Fixed solution to check reach