I just spent an hour doing this... XS