Updated docs
Reorganized code