Implement split function