added the flatten function. (needed for all floors.)