Refactored; simplified