removed scaling and added edge detection