Optimization: Replaced double[][] with float[][]