Refactored to be header-only