removed globals from hooks & added comments