Implemented more APIs and a bunch of bug fixes