better example, fixed bug where callback was fired too many times