encapsulated the EM servers in classes and now shutting down the servers gracefully