refactor block/text pattern