remove parallel and refactor some code