ext: Move ext helper functions from 'main' to 'ext'