Fixed a bug in the circular array expand and contract routines that was making it fail. Also made the permutations module use circular arrays instead of linked lists.