several helper functions added