Function definitions corrected.