added a complicated version