move print breadth first into its own function