added the flip and some tweaks