Added user input checking and code commenting