Added code for traversing board