 He left the army in 1822 and then studied medicine at the University of Edinburgh where his teachers included Professor John William Turner, the professor of surgery.He qualified MD in 1824.He worked variously at the New Town Dispensary, Edinburgh Royal Infirmary (then on Drummond Street) and the Royal Lunatic Asylum in south Edinburgh.