homework and other code from design patterns