modified adapter code