implement stretching function.