better logic when going over a line