corner detection code added