solution 1 revised

Some more comments added.