Complete the perplexity functions (border condtion checking, input table
checking, etc)