implemented some changes to the code splitting functions to shorter functions