Fixed a lot of things, using new api lib