adding Juans code