updated to allow for more particles without seg fault