reworked to operate on epub files as input. bug fixes