Adding Split functionality. Major changes in the code!