reorganized main.cpp, started docs