Program almost translated into English, plus a few minor changes