refactor regsitrant, reduce complexity/duplications