He was awarded the highest marks awarded to any cadet in his Cantonese exams, and after an early postings as a district officer, during which he ambushed a troop of bandits at night and sentenced them, as magistrate, the following day, he was made Secretary for Chinese Affairs in Malacca, and then Secretary for Chinese Affairs in Penang, at the age of 32.