initial commit of original hook plus new features.