Improved centroid localization algorithm in WSNs