refactored particles code, added setting