Added Austin's code, haven't refactored or tested against server.