Initial support for <mode>, general tidying up and other small tweaks Signed-off-by: David Shah <davey1576@gmail.com>