Refactor scheduler, use generic scheduler everywhere, delete old code.

Godoc comment