added flatten and strformat