Fork from https://github.com/polleverywhere/firehose with modifications