refactor to display inputs dynamically