added an initial, untested, and uncommented version to share in class