updated code to reflect algorithms lib change