cleaning up the code, working on new api