DEV: Put elements in right order and add average in output