Added more documentation to api.hpp and state.hpp