revert using maps for input, use alternate method for arrays