re-structure and re organized code based on getting input from file instead of from a string, fix tests and add tempral checking purposes code in main