refactor resetButtons function