code cleanup
flip both directions