Basic implementation, not fully tested

Change-Id: I14732240e4223f1729d2be2e19936471f2766faf