starting to apply design patterns to my prior code