added flat option