better canonical solution