Adding figure handling, needs more testing. Also rudimentary biblio handling