Edge detection code added.