renamed and refactored