improve code for UE