Code reorg and event queue

Changes:
- Reorganized code for better comprehensibility
- Added an event queue to prevent edge case cosmetic issues with Core Animation when commands are spammed too quickly