Some changes to memory allocation and genPossPerms