Ring layer refactoring

I think this code achieves pretty much the same with less efforts.