added k_array and missing pieces from shape