Fixed a few errors and checked results. Everything works