added sprite X flipping, fixed a couple of things