first working version of matrix splitting