Wrote scheduler, and fixed typos in device.c