add ime service & optimize code