Moved random text generation code