Some fixes and added scheduling