Cleaned some major namespace errors, and moved around functions to make more sense.