Cleaned up array functions