added flatteno
refactored flatteno to use defne