more detailed sorting of events preventing dependencies of input order