mods & restructuring to support Solaris 2