Big ol' refactor