added smart cropping