Add support of formatResult and formatSelection