First version of solution. Not yet done.