review of hook system

Added hook() alter() and invoke()

hook() does not longer gets arguments by reference, alter() should be
used instead.