A working parallel version.