optimization idea in progress using 4D arrays