finish title generation code