Fixed some stuff around scheduler, added more tests