Improved secrets handling