Some major refactorings

	modified:   controller.py
	modified:   main.py
	modified:   web.py