Adding command line options and tidying.
Added file grouping for hooks.