small fixes, api improvement, comments