Added flatmode option