Gigantic refactor. Fixes prototype issues. Also might add some minor functionality? Can't tell... whoops.