refactored to not duplicate params