Scheduler callback

Fix for #130 and added documentation in `sched.h`