I forgot to undo some debug stuff, so it cheated a little. Now it's doing what it was supposed to do last time.