Rework code to work with array.
References Issue #201