refactored to use getter instead of direct field