algorithm done but untested