Where does the 10ms number come from?  The previous code appeared to be sampling a status register.  Is that more robust than an arbitrary delay?