refactors some code so I can more easily extend it