Move helper functions to external library.