Solving 2 -- i'm sure that the logic could be cleaned up in the
iteration but its a start