Port for Spark Core of the RemoteSwitch library by github.com/hjgode