Add userdata and message count functions