Backend main functions are now factored out.