First working version. Incomplete API