Added code from MBP server.