Refactored code for adding particles to avoid code duplication.