More refactoring

Added a VoidFunction wrapper to not return null during foreach
foreach directly takes only VoidFunction in the interface
Adding tests for PublishExecutor
removing un-used variable