Refactor Util & add more tests