- replaced long macros with functions