refactoring code using Util