assn1, completed split function