Refactoring to get rid of dependency on Position class and work on pure
int[]