change algorithem to berzanham algorithem