added minimalization scheme. not compiling.