API implemented. There are still some loose ends.