holy crap thats a huge refactor