Impact of Clustering in Different Layers on Performance of Ad Hoc Wireless Networks