Implement traversing of linestack.