adapter code