restructure, add docs, cleanup