Make sure that only unsigned integers are used as array indexes (Extends the idea of the pull request #6). Also increase test cases to cover more complex scenarios