Way better implementation