problem 5
problem 6
problem 7 segfault, need better approach