Added permission checks.

Method names are very messy and need refactoring.