Added support for different delimiters

Refactored a bit as well