I fixed the bugs from the previous version, and added a bunch more.