add comments, modify api, remove unused files