Solution for #5, stub for #6