Fixing bugs

Fixed some bugs so the project now runs without errors and all tests pass