recoding JS and give a nicer form