removed unnecesary exception from algorithm