Refactor QM.applyAll to use QM.forEach
Add specs for QM.applyAll