fixed some mistakes, but not runnable yet