refactor rigths system