Fixed some mistakes

Now the code runs as/does what it should