Mad refactor, still broken