added password function and tests