Added repository class plus matching test class, some refactoring of permissionform generation. Removed namespaces.