Added generate_code function. Now code can be display in the textarea