move input text update to function