Moved helper functions to internal packages