Restructure and add parallel support.