Extracting logic from joshtool to separate php.  Removing some debug info from modules.