improved split functionality, fixed some bugs