Overlay: Code improvements

* Use ARRAY_NUM_ELEMENTS(array) instead of constant