fixing typedef warnings and removing multilevel code