Almost done

Still need some debugging