fixed incorrect handling of returned scheduler option and restructed scheduler functions slightly