Utility functions and array population