Define everything in terms of callbacks. Should fix various small bugs.