code cleaning, better authorization rules