Fixed bug and improved algortihm to be linear