changing book_ping_count to use function as welll