Moved some functionality to a util package