added a nice abortion algorithm