Algorithm testing
Updated algorithm