updated constructor logic