removed visited variable