Clean api code