Major cleanup, of private/ public functions.