working version minus password support