Initial step of the cleanup process: split helper functions into a separate file.