updating internal flatten per latest _. add 'flatten' add 'range'