completed the lean_array function