Changed sandwich and generate_G to handle multiple frequency stuff.