moved mime related op to a lib