Converted the functions from prototype.