replace splitArray implementation with array_chunk

because its a native PHP function for the job
basic refactoring and cleaning