modified slit function so that empty strings are not added