Simplified & fixed and added stuff.

Program should be more reliable now.