Rework new API code

Change-Id: Ie4306677445ebf54c1dffab7ab055c84323e97e4