abstracted letter generator into function