fixed some mistakes, still unfinished