modified initialization logic