Replace commit() with apply()

Problem synopsis
Consider using apply() instead; commit writes its data to persistent
storage immediately, whereas apply will handle it in the background (at
line 49)