- rename `thread_msg_avail` to `msg_avail`, does not require threads - minor code enhancements and corrections