A few minor adjustments per the suggestions from @vlucas.  Also added a test case to ensure that invalid hooks could not be added.