Removed unnecessary flatten call