Refactor, add api.util package