Code clean up
Refactored permission checks in controllers