a little refactor
need input name in index