~ refactored based on code review