Updated logic for visual mapping