functions for datastrcut