Finished the sequential version and added in variable class for parallel reduction