implement parallel processing and fix some problems