Solutions for problems 40 and 42
Some small fixes