remove the extra spaces in this function