merged code for initial base