edited initialization function