Implementation of Basic Algo