removed a layer of array iteration using the flatten method

Signed-off-by: Andrew Deitrick <ajdeitrick@gmail.com>