added edge detect back in