restructure and add documentation