Remove trailing space function