adjusted code