complete prog with comments