Improved documentation,  changed API