Adding problem 2 and cleaning up problem 1
Add problem 3, reorganize code structure