Fixed, shortend and updated problem 2