More linear algeblah, moved it all to a new file after I felt too bad