clean up flip code a bit. working on an eventual clean bit of code +