Implementing split function for both new line and comma