After you get the derailleur and hanger straight, and correcting any deficiencies like cable installation problems, follow this procedure from the beginning without skipping any steps.
Park Tool Co. » ParkTool Blog » Rear Derailler Adjustments (derailleur)
Make small adjustments and smaller yet as you get close. 1/4 turn at a time may be too much; sometimes less than 1/8 turn will make all of the difference between perfect and so-so shifting.