Gen 4 and gen 3 parts question

Could you switch the trigger/trigger bar from a gen 3 glock 23 to a gen 4 17, and vice versa. I ask because the gen 4 trigger is not as good as the gen 3. I rarely shoot the 23, and considered changing some stuff around to give the gen 4 a better pull. Obviously I won't be swapping the ejectors around.