Made library auto detect environment and initialize appropriately