improved solution for problem 1
improved solution problem 1 again
improved solution 2