refactoring to allow event parsing per trial as well as per variable