enormous refactor