event listener, first pass
fix formatting, add more robust tests