moved crop to function