Fixed a few bugs, but code still not working