Restructured things more modularly.

Still need to namespace binds so "global" isn't necessary.