Refactored some code. Added logging for list of loaded plugins.