refactored UAM and authentication