Move wait to its own function
Remove debug prints
Add go.{h,c} and use it for output