Documented problem 5
Better testing and compexity for problem 5