Tidied up pagination so that we can put buttons at the top as well as bottom