clean up code for 4, 5, 6, 8