implemented problem 4 framework