minor refactors for code clarity