Refactored into client and server node