more refactors for clarity