implementing eventmachine