gave up on optimization and took the occam's razor approach.... problem 4 completed.