Code from my cs311 class.