more efficient algorithms added