Code I wrote while studying for a B. S. Eng, McGill Software Engineering, 2006