a massive refactor so that I can better reuse the code already written between projects.