More work towards making the CLI work again (see #16). Still not complete.