Added null-check on events argument to main method.