In a medium-sized heatproof bowl, mix the sugar and egg yolks together. (Don't let the mixture sit too long or you will get pieces of egg forming.)
Sift the flour and cornstarch (corn flour) together.
Add to the egg mixture, mixing until you get a smooth paste.
Meanwhile, in a saucepan bring the milk just to boiling. (just until milk starts to foam up)
Remove from heat and add slowly to egg mixture, whisking constantly to prevent curdling. (If you get a few pieces of egg (curdling) in the mixture, pour through a strainer)
Pour the egg mixture into a medium saucepan and cook over medium heat until boiling, whisking constantly.
When it boils, whisk mixture constantly for another 30 - 60 seconds until it becomes thick.
Remove from heat and immediately whisk in the liqueur (if using).
Stir in vanilla extract.
Pour into a clean bowl and immediately cover the surface with plastic wrap to prevent a crust from forming.
Cool to room temperature.
If not using right away refrigerate until needed, up to 3 days.
Whisk or stir before using to get rid of any lumps that may have formed.