code refactoring of images functions
code refactoring and improvements on searching the vertical corner line