Final touches. Everything works as expected. An extra option to cancel C leg might be needed (maybe an extra configuration option to configure flash context)