updtaemotion   function refactored