Some util refactor