Which of these sentences is correctly written?
A) When reaching the secret chamber in the left wing, leaning against a beam to recover his breath, and praying that he might find what he needed.
B) When reaching the secret chamber in the left wing, he leaned against a beam to recover his breath, he prayed that he might find what he needed.
C) On reaching the secret chamber in the left wing, leaning against a beam to recover his breath praying that he might find what he needed.
D) On reaching the secret chamber in the left wing, he leaned against a beam to recover his breath and prayed that he might find what he needed.