consolidate init code