Some code cleanup (namespace and made some internal methods private).