Added functions, mostly programming practice.