refactoring: avoid mutable object state