Visibility and minor code cleanup