Fixed some bugs + function to add array with headers