make library_map use a context so that it can be used in multiple places