Algorithm Implementations phase 1