simplify event handling to avoid subshells