Updated for extensibility and websockets