refactoring readertoc and readerfooter

so that they don't repeat themselves.