retested; main issues are 2D array and function call/return values