Started actually writing gen_schedule().
Initial auto-scheduler
Fixed merge conflict