switching to atomic blocks and adding check password function