Which sentence contains a misplaced or dangling modifier?

A. Unexpectedly, a peal of rolling thunder woke me up.


B. To turn off the security alarm, punch in the code.


C. The boy was very excited to be swimming with the dolphins.


D. We anchored the boat fearfully worrying about the impending storm.