added replace space function