Implement getnodes method and add testing for it