modifications to algo