factored code, custom delimiter and default delimiter functions added