Plug memory leak;  Break three compilation mechanisms into routines.