Split processing functions from main program