fixed API and added more docs