fixed the bug! checks, checkmates, and legal moves all work now!
...to the best of my knowledge.
Will come up with more test cases soon