Add count limit option to loop observer; refactor tests