using array instead of hashes and sets