Add a scheduler

Issue #300