More implementation code in preparation for merge with Colin's sensor implementation.