added tuesday's lecture alg, fixed some bugs in fima