added in the sorting for pictures using code from femi's branch
still need to see the pictures tho so not sure if the sort is really working yet