Factored out base functions to support bootstrap 2 or 3