State Upgrades

In order to prepare for future expansion, placed all static state code
into a "library" namespace. Also was able to upgrade all of the states,
improving both readability and speed of evaluation. Also moved all extra
classes from BSON and crypto into the user namespace; they should have
been here in the first place!