Almost done. bug_output is the next bug to fix