edited for new protocol