Refactor code to allow the addition of an extension to make it parallel