added condition again and set max height and width