Refactoring to make code more self-documenting.

Extract methods, change visibility scope of non-hook callback methods etc.
Removed the redundant function exists check for 'get_plugins' for now.
Wrap comments at 80 characters.