refactoring for my personal sanity