Algorithims Implementations