Imported code from Nitrous.IO