refactor part of Util