Copied and pasted solution to hmw1