improving algoritms