Schedule blocks and more refactoring
More schedule refactoring
Various fixes and improvements