Switched map to doseq to fix lazy issue