Automatically sort events where possible, and enhance schedule length validation