median functions, minor refactoring

created some static functions that calculate the BookShelf-aligned
median of a range between two points in the file.
also defined size macros for both Book and BookShelf structs.