Fixed various bugs. Added support fot book independence.