swap order so errors in the handler don't block command activation
refactor