few modifications done by me