add new code from Puzan