Code from following these great video tutorials here: http://www.computerscienceforeveryone.com/