Updating logging and checking. All tested now.