Implementation of the Compute method