almost done, have to fix a few bugs