Solution by Magnus Woldrich
