Changed wait to handle background processes better

Still untested.
Changed name to correct suffix
Made working makefile
Added proper attribution to author
Added file redirection. Untested