Modularize the initialization function