big ol' refactor