trying to isolate reusable parts of code, needs to look into generators