Implemented improved algorithms