Updated with basic pseudo code and some of the program flow.