updated (finally) code for Ruby 2.x and made the error raised if kill == true to include original error message, this was not in the original code because I'm an idiot