Wrote split function