made example more responsive and minor cleanup