Simplified solution for part 1