Reorganize common functions and settings.