Refactored: js