Added DetectSurface class, not working yet. Some optimizations