add documentation
tighten up the api