First attempt at scheduler