Added functionality for handling joins through events and multi-threaded