Minimal refactor of original thea