Optimized create_password method and created tests