Attempt 2: Code implementation