adjusted code #189