Added stdin stdout print to file spec and cleaned up the code
Fixed bg processes bug