reorganize and add documentation