modified for more mesh resolution.