main file cleaned

Removed a bunch of deprecated code sitting commented out
Ensured all functions were reasonably documented
Cleaned up formatting