modified accroding to the comments