Solution to #2-4