Adding role change permission tests, plus started refactoring