Updating to make restriction check more robust. Including tests.
Refactoring controller method, improving tests
Merge pull request #1072 from scottsds/issue_2798

Updating to make restriction check more robust. Including tests.