Lab 6.4 - Direct copy and paste of Brian's code.