complete the functoin