refactor and collect utils.h