Adding code from Peter Wallen for Hornby controller.