modified old code