made delim const
Simplified remove function