NEW Feature - edge detection

add new feature and improve the code