Moved the connection accepting logic to a seperate thread.