I fixed the bugs, this is a working version now! As long as it compiles:)