Permissions reworked, some cleanup