v0.5. Added save password function and cleaned up code