Role table and refactoring