Initial commit of lib extracted for SDC - as this.