Now working for noisy images