tidied up epub export code, and added links in gallery