Refactored, removed new conditional and reworded regex to handle multiple newlines as delimiters