Added Sverrir's code