refactored to match earlier changes in different part