[IM] Extracting same function from different places