Refactored AddTextToBlock method