This was a long one but it was good practice