Used collect instead of each