Refactor delimiter extraction

Uses pattern matching in stead of if statement and introduces
a typeclass for encapsulating a refined input