initialization phase 2

cleaned up the code a bit to be more functional, the initialization
phase still needs the rearranging at the end before the pivoting can
continue