Perk Refactoring

I did some pretty major refactoring on the perk system. I'm not actually sure it was all necessary, but I fixed a few bugs that had been present for a while.