corrected according to comments