David Hughes, Royal Engineers