Fixes #5: add autoflipping.