Moved helper functions