removing extra spaces from result