Made changes & completed algorithm implementation.