Second part is done, still a bit inelegant