Remove end spaces passing unit tests