added James's ring code