Imported from https://github.com/viibridges/crossnet