refactored ringFlock.js